package com.yowasa.xiuxian.engine.hone.special;

import com.yowasa.xiuxian.annoations.SE;
import com.yowasa.xiuxian.constant.XiuxianConstants;
import com.yowasa.xiuxian.engine.hone.SpecialInterface;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.bo.user.UserBattle;
import com.yowasa.xiuxian.entity.enums.ElementEnum;
import com.yowasa.xiuxian.exception.HandlerException;

@SE(name = "五行轮转")
public class WuXingLunZhuan implements SpecialInterface {
    @Override
    public ElementEnum getElement() {
        return ElementEnum.GOLD;
    }

    @Override
    public void limit(UserBO user) {
        String lingGenDesc = ElementEnum.getLingGenDesc(user.getElement(), XiuxianConstants.DEFAULT_ELEMENT_ACTIVITY);
        if (lingGenDesc.length() < 5) {
            throw new HandlerException("学习/使用五行轮转必须要同时拥有5种灵根");
        }
    }

    @Override
    public String limitDesc() {
        return "同时拥有5种灵根";
    }

    @Override
    public String desc() {
        return "修习之后提高10%的全战斗属性";
    }

    @Override
    public void effectBattle(UserBO userBO,UserBattle userBattle) {
        userBattle.setHp((int) (userBattle.getHp() + userBO.getUserOriginBattle().getHp() * 0.1));
        userBattle.setMp((int) (userBattle.getMp() + userBO.getUserOriginBattle().getMp() * 0.1));
        userBattle.setAtk((int) (userBattle.getAtk() + userBO.getUserOriginBattle().getAtk() * 0.1));
        userBattle.setSpell((int) (userBattle.getSpell() + userBO.getUserOriginBattle().getSpell() * 0.1));
        userBattle.setDef((int) (userBattle.getDef() + userBO.getUserOriginBattle().getDef() * 0.1));
        userBattle.setRes((int) (userBattle.getRes() + userBO.getUserOriginBattle().getRes() * 0.1));
        userBattle.setImm((int) (userBattle.getImm() + userBO.getUserOriginBattle().getImm() * 0.1));
        userBattle.setSpd((int) (userBattle.getSpd() + userBO.getUserOriginBattle().getSpd() * 0.1));
    }
}
